package fr;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import fr.esiag.projet17.bo.ObjectFactory;
import fr.esiag.projet17.bo.Role;


public class Main {
	public static void main(String args[]) throws JAXBException{
		JAXBContext jaxbContext=JAXBContext.newInstance("fr.esiag.projet17.bo");
		Marshaller marshaller=jaxbContext.createMarshaller();
		ObjectFactory factory=new ObjectFactory();
		Role role = factory.createRole();
		
		role.setId(new Long(1));
		role.setNom("daniel");
		StringWriter sw =new StringWriter();
		BufferedWriter bufWriter = new BufferedWriter(sw);
		
		marshaller.marshal(role, bufWriter);	
		
		System.out.println(sw.toString());
		try {
			bufWriter.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
